package practicedemo32;

public class GoodsTest {
    public static void main(String[] args) {
        //创建一个包含Goods的类数组arr
        Goods[] arr = new Goods[3];

        //创建商品对象
        Goods g1 = new Goods("001","水杯","100元");
        Goods g2 = new Goods("002","茶叶","50元");
        Goods g3 = new Goods("003","枸杞","30元");

        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;

        for (int i = 0; i < arr.length; i++) {
            System.out.printf("%s,%s,%s\n",arr[i].getId(),arr[i].getName(),arr[i].getPrice());
        }
    }
}
